package com.michale.common.properties;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author Michale
 * @apiNote 账户信息配置
 */
@Data
@Component
@ConfigurationProperties(prefix = "michale")
public class MichaleProperties {

    @ApiModelProperty("项目名称")
    private String name;
    @ApiModelProperty("版本")
    private String version;
    @ApiModelProperty("实例演示开关")
    private boolean demoEnabled;
    @ApiModelProperty("版权年份")
    private String copyrightYear;
    @ApiModelProperty("上传路径")
    private static String profile;
    @ApiModelProperty("获取地址开关")
    private static boolean addressEnabled;

    @ApiModelProperty("验证码类型")
    private static String captchaType;
    @ApiModelProperty("获取导入上传路径")
    public String getImportPath() {
        return getProfile() + "/import";
    }

    @ApiModelProperty("获取头像上传路径")
    public String getAvatarPath() {
        return getProfile() + "/avatar";
    }

    @ApiModelProperty("获取下载路径")
    public String getDownloadPath() {
        return getProfile() + "/download/";
    }

    @ApiModelProperty("获取上传路径")
    public String getUploadPath() {
        return getProfile() + "/images";
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getCopyrightYear() {
        return copyrightYear;
    }

    public void setCopyrightYear(String copyrightYear) {
        this.copyrightYear = copyrightYear;
    }

    public boolean isDemoEnabled() {
        return demoEnabled;
    }

    public void setDemoEnabled(boolean demoEnabled) {
        this.demoEnabled = demoEnabled;
    }

    public static String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        MichaleProperties.profile = profile;
    }

    public static boolean isAddressEnabled() {
        return addressEnabled;
    }

    public void setAddressEnabled(boolean addressEnabled) {
        MichaleProperties.addressEnabled = addressEnabled;
    }

    public static String getCaptchaType() {
        return captchaType;
    }

    public void setCaptchaType(String captchaType) {
        MichaleProperties.captchaType = captchaType;
    }
}
